package com.example.kotlin01

enum  class EmuClassess (val index:Int):OnChangedListener {
    ONE(1) {
        override fun onChanged() {
            println("do one .....")
        }
    },TWO(2) {
        override fun onChanged() {
            println("do TWO .....")
        }
    },THREE(3) {
        override fun onChanged() {
            println("do THREE .....")
        }
    },FOUR(4) {
        override fun onChanged() {
            println("do FOUR .....")
        }
    },FIVE(5) {
        override fun onChanged() {
            println("do FIVE .....")

        }
    }

}
interface OnChangedListener {

    fun onChanged()

}


fun main() {
    val day = EmuClassess.ONE
    //获取值
    println(day.index)
    //调用接口
    day.onChanged()
    //获取包含所有枚举值的数组
    val value1 = EmuClassess.values()
    value1.forEach {
        println(it)
    }
}